package com.highspeed.bdk.bean.entity.physical;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.highspeed.bdk.bean.base.IncrementEntity;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by chenjiabin on 2018/3/23.
 */
@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
@QueryCacheable
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class MachineBox extends IncrementEntity {

    @Column(nullable = false, length = 32)
    private String machineBoxName;

    @Column(nullable = false, length = 32)
    private String machineBoxNo;

    @Column(length = 255)
    private String remark;

    @ManyToOne(optional = false)
    @JoinColumn(name = "PhysicalTopology_id", nullable = false)
    private PhysicalTopology physicalTopology;

    @OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, mappedBy = "machineBox")
    private List<Board> boards = new ArrayList<Board>(0);

    public String getMachineBoxName() {
        return machineBoxName;
    }

    public void setMachineBoxName(String machineBoxName) {
        this.machineBoxName = machineBoxName;
    }

    public String getMachineBoxNo() {
        return machineBoxNo;
    }

    public void setMachineBoxNo(String machineBoxNo) {
        this.machineBoxNo = machineBoxNo;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<Board> getBoards() {
        return boards;
    }

    public void setBoards(List<Board> boards) {
        this.boards = boards;
    }

    public PhysicalTopology getPhysicalTopology() {
        return physicalTopology;
    }

    public void setPhysicalTopology(PhysicalTopology physicalTopology) {
        this.physicalTopology = physicalTopology;
    }
}
